import { getData, postData } from "@/utils/request";

// 获取文章列表
export const showArticleData = async (type, page, size) => {
    return await postData('/dynamicArticleManagement/baseStyle/', { type, page, size });
};

// 获取党校培训列表
export const getAllTrain = async (page, pageSize) => {
    return await postData('/dynamicTrainManagement/getAllTrain', { page, pageSize });
};

// 获取文章详情
export const getArticleDetailsData = async (id, messageId) => {
    return await getData(`/dynamicArticleManagement/baseStyleDetail/${id}/${messageId}`);
};

// 获取党校培训详情
export const getDetailTrainInfo = async (userId, id) => {
    return await getData(`/dynamicTrainManagement/getDetailTrainInfo/${id}/${userId}`);
};

// 给文章或者党校培训点赞
export const praiseArticle = async (userId, articleId, operation, type) => {
    return await postData('/dynamicPraiseRecord/praiseArticle', { userId, articleId, operation, type });
};

// 收藏文章
export const starArticle = async (userId, messageId) => {
    return await postData('/wxUserCollect/insert', { userId, messageId });
};

// 取消收藏文章
export const cancelStarArticle = async (userId, messageId) => {
    return await postData('/wxUserCollect/cancelCollection', { userId, messageId });
};
